package yl.hs.bmipfull.controllers.host;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import yl.hs.bmipfull.controllers.ControllerBase;
import yl.hs.bmipfull.pojo.host.ProductionLineSqlConfigEntity;
import yl.hs.bmipfull.pojo.production.ProductionLineEntity;
import yl.hs.bmipfull.security.HostValidation;
import yl.hs.bmipfull.service.host.IProductionLineSqlConfigService;
import yl.hs.bmipfull.service.production.IProductionLineService;
import yl.hs.bmipfull.viewmodels.WebResult;

/**
 * @author 张凯
 * @apiNote 主机程序请求主机配置信息 -控制层
 * @since 21-7-1 上午 10:58 创建
 */
@Api(value = "主机配置信息Web接口", tags = "主机程序——主机配置信息操作")
@RequestMapping("/host/lineConfig")
@RestController
public class LineConfigController extends ControllerBase {


    final
    IProductionLineSqlConfigService sqlConfigService;

    final
    IProductionLineService lineService;



    public LineConfigController(IProductionLineSqlConfigService sqlConfigService, IProductionLineService lineService) {
        this.sqlConfigService = sqlConfigService;
        this.lineService = lineService;

    }


    @ApiOperation(value = "查询主机语句配置信息", notes = "根据生产线名称查询主机语句配置信息")
    @RequestMapping(value = "", method = RequestMethod.GET)
    public WebResult getLineSqlConfig() {
        ProductionLineEntity line = HostValidation.getLine();
                ProductionLineSqlConfigEntity sqlConfigEntity = sqlConfigService.findBySn(line.getSn());
                return success("获取成功", sqlConfigEntity);
    }

}
